package smartbooks.ui.helper;

import smartbooks.exceptions.MyException;
import smartbooks.ui.util.CommonConstants;
import smartbooksdb.hibernatebean.Item;

/**
 *
 * @author Ankit
 */
public class ItemHelper implements CommonConstants {
    /**
     * This method is used to validate the item panel
     * @param item
     * @return 'true' if item panel is validated or else 'false'
     * @throws MyException
     */
    public static boolean validateItem(Item item) throws MyException {
        boolean itemPanelValidated = true;
        
        if(null==item.getItemName() || item.getItemName().length()==0) {
            throw new MyException(ITEM_NAME, "Item name cannot be blank");
        }
        
        return itemPanelValidated;
    }
}